home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performPolyNormal.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.9 KB  |  146 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  18 April 1997
  22. //
  23. //  Description:
  24. //      Mel support for ply normal operations.
  25. //
  26.  
  27. global proc performPolyNormalSetup (string $parent, int $forceFactorySettings)
  28. {
  29.     if ($forceFactorySettings || !`optionVar -exists polyNormalMode`) {
  30.         optionVar -intValue polyNormalMode 3;
  31.     }
  32.     setParent $parent;
  33.  
  34.     int $ival = `optionVar -q polyNormalMode`;
  35.     int $item;
  36.  
  37.     switch ($ival) {
  38.     case 0:
  39.         $item = 1;
  40.         break;
  41.     case 1:
  42.         $item = 2;
  43.         break;
  44.     case 2:
  45.         $item = 2;
  46.         break;
  47.     case 3:
  48.         $item = 2;
  49.         break;
  50.     case 4:
  51.         $item = 3;
  52.         break;
  53.     }
  54.  
  55.     optionMenuGrp -edit -sl $item polyNormalMode;
  56. }
  57.  
  58.  
  59. global proc performPolyNormalCallback(string $parent, int $doIt)
  60. {
  61.     setParent $parent;
  62.     int $whichItem = `optionMenuGrp -query -sl polyNormalMode`;
  63.     int $mode;
  64.  
  65.     switch ($whichItem) {
  66.     case 1: // menuItem -l "Reverse" polyNormalReverseItem;
  67.         $mode = 0;
  68.         break;
  69.     case 2: // menuItem -l "Reverse and Extract" polyNormalReverseExtractItem;
  70.         $mode = 3;
  71.         break;
  72.     case 3: // menuItem -l "Reverse and Propogate" polyNormalReversePropogateItem;
  73.         $mode = 4;
  74.         break;
  75.     }
  76.     optionVar -intValue polyNormalMode $mode;
  77.     if ($doIt) {
  78.         performPolyNormal 0 $mode 0;
  79.         string $tmpCmd = "performPolyNormal 0 " + $mode + " 0";
  80.         string $tmpLabel = "PolyReverseNormal";
  81.         addToRecentCommandQueue $tmpCmd $tmpLabel;
  82.     }
  83. }
  84.  
  85. proc polyNormalOptions()
  86. {
  87.     string $commandName = "performPolyNormal";
  88.     string $callback = ($commandName + "Callback ");
  89.     string $setup = ($commandName + "Setup ");
  90.  
  91.  
  92.     string $layout = getOptionBox();
  93.     setParent $layout;
  94.     setUITemplate -pushTemplate DefaultTemplate;
  95.     scrollLayout;
  96.  
  97.     string $parent = `columnLayout -adj true`;
  98.     optionMenuGrp -l "Mode" polyNormalMode;
  99.         menuItem -l "Reverse" polyNormalReverseItem;
  100.         menuItem -l "Reverse and Extract" polyNormalReverseExtractItem;
  101.         menuItem -l "Reverse and Propogate" polyNormalReversePropogateItem;
  102.     setParent -m ..;
  103.     optionMenuGrp -e -sl 2 polyNormalMode;
  104.     setUITemplate -popTemplate;
  105.  
  106.     string $applyBtn = getOptionBoxApplyBtn();
  107.     button -edit -label "Reverse Normals"
  108.            -command ($callback + " " + $parent + " " + 1)
  109.         $applyBtn;
  110.     string $saveBtn = getOptionBoxSaveBtn();
  111.     button -edit
  112.         -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
  113.         $saveBtn;
  114.     string $resetBtn = getOptionBoxResetBtn();
  115.     button -edit
  116.         -command ($setup + " " + $parent + " " + 1)
  117.         $resetBtn;
  118.  
  119.     setOptionBoxTitle("Polygon Reverse Normals Options");
  120.  
  121.     setOptionBoxHelpTag( "NormalsReverse" );
  122.  
  123.     eval (($setup + " " + $parent + " " + 0));
  124.  
  125.     showOptionBox();
  126. }
  127.  
  128. global proc string performPolyNormal (int $option, int $mode, int $ret)
  129. {
  130.     if ($mode < 0) {
  131.         $mode = `optionVar -q polyNormalMode`;
  132.     }
  133.  
  134.     switch ($option) {
  135.     case 0:
  136.         string $cmd = ("polyNormal -normalMode " + $mode);
  137.         return `polyPerformAction $cmd f $ret`;
  138.  
  139.     case 1:
  140.         polyNormalOptions;
  141.         return "";
  142.         break;
  143.     }
  144.     return "";
  145. }
  146.